﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using Telerik.Web.UI;

public partial class Admin_Confirm : System.Web.UI.Page
{
    protected void LogoutButton_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        FormsAuthentication.SignOut();
        Response.Redirect("~/Default.aspx");
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            AddTab("Test2UserControl", "تست نوع دوم");
            AddPageView(RadTabStrip1.FindTabByValue("Test2UserControl"));
            //AddPageView(RadTabStrip1.FindTabByValue("Test1UserControl"));
            AddTab("Test1UserControl", "تست نوع اول");
        }
    }

    private void AddTab(string tabName, string tabText)
    {
        RadTab tab = new RadTab();
        tab.Text = tabText;
        tab.Value = tabName;
        RadTabStrip1.Tabs.Add(tab);
    }

    protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
    {
        string userControlName = e.PageView.ID + ".ascx";

        Control userControl = Page.LoadControl(string.Format("~//{0}//Ok//{1}", "UserControl", userControlName));
        userControl.ID = e.PageView.ID + "_userControl";

        e.PageView.Controls.Add(userControl);
    }

    private void AddPageView(RadTab tab)
    {
        RadPageView pageView = new RadPageView();
        pageView.ID = tab.Value;
        RadMultiPage1.PageViews.Add(pageView);
        pageView.CssClass = "pageView";
        tab.PageViewID = pageView.ID;
    }

    protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
    {
        AddPageView(e.Tab);
        e.Tab.PageView.Selected = true;
    }

}